home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Telnet / NCSA / tn3270 2.4d7 source / tn3270 / termdef.h < prev    next >
Text File  |  1992-04-17  |  29KB  |  784 lines

  1. /*
  2.  *  tn3270 for the Macintosh Source Code
  3.  *  Brown University Computing and Information Services
  4.  *  Version 2.4d7  April, 1992
  5.  *  Copyright (c) 1988, 1989, 1990, 1991, 1992 by Brown University and by
  6.  *  Peter John DiCamillo.
  7.  *
  8.  *  Permission is granted to any individual or institution to use, copy,
  9.  *  or redistribute the binary version of this software and its
  10.  *  documentation provided this notice and the copyright notices are
  11.  *  retained.  Permission is granted to any individual or non-profit
  12.  *  institution to use, copy, modify, or redistribute the source files
  13.  *  of this software provided this notice and the copyright notices are
  14.  *  retained.  This software may not be distributed for profit, either
  15.  *  in original form or in derivative works, nor can the source be
  16.  *  distributed to other than an individual or a non-profit institution.
  17.  *  Any  individual or group interested in seeing and/or using these
  18.  *  source files but who are prevented from doing so by the above
  19.  *  constraints should contact Don Wolfe, Assistant Vice-President for
  20.  *  Computer Systems at Brown University, (401) 863-7250, for possible
  21.  *  software licensing of the source developed at Brown.
  22.  *
  23.  *  Brown University and Peter John DiCamillo make no representations
  24.  *  about the suitability of this software for any purpose.
  25.  *
  26.  *  BROWN UNIVERSITY AND PETER JOHN DICAMILLO GIVE NO WARRANTY, EITHER
  27.  *  EXPRESS OR IMPLIED, FOR THE PROGRAM AND/OR DOCUMENTATION PROVIDED,
  28.  *  INCLUDING, WITHOUT LIMITATION, WARRANTY OF MERCHANTABILITY AND
  29.  *  WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE.
  30.  *
  31.  */
  32.  
  33. #define    NUL        0x00
  34. #define CD        0x01
  35. #define GRFBGN    0x04
  36. #define XFBGN    0x06
  37. #define    BEL    0x07
  38. #define    BS    0x08
  39. #define TAB 0x09
  40. #define    LF    0x0a
  41. #define VT    0x0b
  42. #define FF    0x0c
  43. #define    CR    0x0d
  44. #define SO    0x0e
  45. #define    DC1    0x11
  46. #define    DC3    0x13
  47. #define DC4 0x14
  48. #define CPMEOF 0x1a
  49. #define    ESC    0x1b
  50. #define    DEL    0x7f
  51.  
  52.                                 /* equates for VM CP DIAG X'7C' ldev creation */
  53. #define WSFFLAG        0x80            /* flag for Write Structured Field support */
  54. #define MDL32782    0x02            /* 3278 model 2 (24 by 80) */
  55. #define MDL32783    0x03            /* 3278 model 3 (32 by 80) */
  56. #define MDL32784    0x04            /* 3278 model 4 (43 by 80) */
  57. #define MDL32785    0x05            /* 3278 model 5 (27 by 132) */
  58. #define MDL32792    0x92            /* 3279 model 2 (24 by 80) */
  59. #define MDL32793    0x93            /* 3279 model 3 (32 by 80) */
  60. #define CLASGRAF    0x40
  61. #define TYP3278        0x01
  62.  
  63. #define NMENUS    7
  64.  
  65. #define portalrt        256        /* stoperr message codes */
  66. #define loadalrt        257
  67. #define srvalrt            258
  68. #define atpalrt            259
  69. #define rmtalrt            260
  70. #define nackalrt        261
  71. #define ioalrt            262
  72. #define    rsetalrt        263
  73. #define ssetalrt        264
  74. #define wsetalrt        265
  75. #define addralrt        266
  76. #define regalrt            267
  77. #define cfigalrt        268
  78. #define domalrt            269
  79. #define topnalrt        270
  80. #define conalrt            271
  81. #define rspalrt            272
  82. #define numalrt            273
  83. #define negalrt            274
  84. #define wrtalrt            275
  85. #define et1alrt            276
  86. #define    et2alrt            277
  87. #define    et3alrt            278
  88. #define mapalrt            279
  89. #define wpictalrt        280
  90. #define kbdefalrt        281
  91. #define kbsetalrt        282
  92. #define nlsetalrt        283
  93. #define fmtalrt            284
  94. #define hostfalrt        285
  95. #define sdsetalrt        286
  96. #define sdmemalrt        287
  97. #define newwindalrt        288
  98. #define windfmtalrt        289
  99. #define apinalrt        290
  100. #define apisalrt        291
  101. #define pnumalrt        292
  102. #define ppcinitalrt        293
  103. #define ppcnamealrt        294
  104. #define ppcopenalrt        295
  105. #define nodrvalrt        296
  106. #define sesslimalrt        297
  107. #define newsesalrt        298
  108.  
  109.                                 /* definitions for built-in fonts */
  110. #define SYMBOLFONT    239
  111. #define NORMALFONT    240
  112. #define APLFONT        241
  113. #define BOLDNORMAL    242
  114. #define BOLDAPL        243
  115. #define ALAFONT        244
  116. #define BOLDALA        246
  117.  
  118. typedef struct {                /* element of keyboard input queue */
  119.     unsigned char code;
  120.     unsigned char shift;
  121.     } kbdata;
  122. #define KBQMAX    200                /* size of keyboard input queue */
  123.  
  124. #define WRITEINFOCOUNT 4        /* how many previous writes to save stats on */
  125. #define INFODATASIZE 8            /* bytes of data to save */
  126.  
  127. typedef struct {
  128.     unsigned long seqnum;            /* sequence number */
  129.     unsigned long start_ticks;        /* tick count at call */
  130.     unsigned long end_ticks;        /* tick count after completion */
  131.     unsigned short length;            /* number of bytes */
  132.     unsigned short calls;            /* number of calls to netwrite */
  133.     short result;                    /* final result code */
  134.     unsigned char data[INFODATASIZE];  /* start of data */
  135.     } writeinfo;
  136.  
  137. #define MAXSESSIONS 8            /* maximum number of sessions allowed */
  138.  
  139. typedef struct {
  140.     unsigned char * name;
  141.     unsigned char type;        /* type values: */
  142.                              /* a = string of arbitrary length (size = 1)
  143.                                 b = binary flag (size = 1)
  144.                                  c = unsigned char (size = 1), decimal
  145.                                 i = (signed) short int (size = 2)
  146.                                 l = list of hex bytes (size = no. of bytes)
  147.                                 o = OSType (4 bytes, unterminated)
  148.                                 r = RGBColor: 3 unsigned short ints (size = 3)
  149.                                 s = character string (size = max. length.)
  150.                                 u = unsigned short (size = 2) 
  151.                                 x = unsigned char (size = 1), hex */
  152.     unsigned char size;
  153.     void *valptr;
  154.     unsigned char *description;
  155.     short (*procptr)(void *resptr);        /* validation procedure */
  156.     } keyinfo;
  157.  
  158. /* settings, except for variable-length strings */
  159.  
  160. typedef struct {
  161.     unsigned char     attrmap[7];            /* attribute mappings */
  162.     char            dblevel;            /* debug level */
  163.     char             setsflg;            /* connection mode */
  164.     unsigned char    timeout;            /* seconds between retransmits */
  165.     unsigned char    retries;            /* number of retries */
  166.     char            insreset;            /* attn resets insert mode */
  167.     char            impnull;            /* improved null processing */
  168.     char            digitpfk;            /* Cmd Shift <digit> is PF */
  169.     short            mousepf;            /* double-click function */
  170.     char            basecolor;            /* base color mode */
  171.     char            exactcolor;            /* exact colors wanted */
  172.                                         /* current color settings */
  173.     RGBColor        usrwhite;
  174.     RGBColor        usryellow;
  175.     RGBColor        usrpink;
  176.     RGBColor        usrturquoise;
  177.     RGBColor        usrgreen;
  178.     RGBColor        usrred;
  179.     RGBColor        usrblue;
  180.     RGBColor        usrblack;
  181.     RGBColor        usrback;
  182.     RGBColor        usrstat;
  183.     short            dfltptsize;            /* default screen point size */
  184.     short            altptsize;            /* alternate screen point size */
  185.     short            altrows;            /* rows for alternate screen */
  186.     short            altcols;            /* columns for alternate screen */
  187.     short            custrows;            /* custom row size */
  188.     short             custcols;            /* custom column count */
  189.     short            windpth;            /* window center point- horiz. pos. */
  190.     short            windptv;            /* window center point- vert. pos. */
  191.     char            invertbw;            /* swap black and white */
  192.     char            stat_time;            /* status line time display */
  193.     char            curpos;                /* display cursor position */
  194.     char            blockcurs;            /* block cursor */
  195.     char            ext3270;            /* extended data stream support */
  196.     char             std_brack;            /* treat [ and ] normally */
  197.     char            windmax;            /* always use maximum window size */
  198.     char             repnull;            /* change embedded blanks to nulls */
  199.     char            savewpos;            /* save window position in file */
  200.     char            autoconn;            /* connect to host when settings loaded */
  201.     OSType            text_creator;        /* creator for text files */
  202.     char            simps;                /* simulate programmed symbol support */
  203.     char            keepwindow;            /* window persists after close */
  204.     char            nographics;            /* don't allocate graphics bitmap */
  205.     char            nocolor;            /* bitmaps only 1 bit deep */
  206.                                 /* even length should be maintained */ 
  207.     } settings_list;
  208.  
  209. struct mbhdr {                /* MacBinary header */
  210.     unsigned char         ver;        /* version byte */
  211.     unsigned char        fnlen;        /* length of filename */
  212.     unsigned char        fn[63];        /* filename */
  213.     unsigned char        ftyp[4];    /* file type */
  214.     unsigned char        fcreat[4];    /* file creator */
  215.     unsigned char        flags;        /* finder flags */
  216.     unsigned char        flags2;        /* second flag byte */
  217.     unsigned char        vpos[2];    /* vertical position */
  218.     unsigned char        hpos[2];    /* horizontal position */
  219.     unsigned char        id[2];        /* window or folder ID */
  220.     unsigned char        pflag;        /* "protected" flag */
  221.     unsigned char        zero2;        /* zero */
  222.     unsigned char        dataln[4];    /* data fork length */
  223.     unsigned char        rscln[4];    /* resource fork length */
  224.     unsigned char        crdate[4];    /* creation date */
  225.     unsigned char        mddate[4];    /* last modified date */
  226.     unsigned char        zero3[29];    /* zero fill */
  227.     };
  228.  
  229. typedef struct vmprt {                /* values to control WMAC PRINT output */
  230.                             /* default:     definition:                    */
  231.     unsigned short fontnum;        /* 22        font number */
  232.                                 /*            monaco = 4; courier = 22 */
  233.     unsigned short pointsize;    /* 11        font point size */
  234.     unsigned short leading;        /* 12        line spacing, inches*72 */
  235.     unsigned short linewidth;    /* 132        maximum characters per line; */
  236.                                 /*            *cannot exceed 132* */
  237.     unsigned short tabsize;        /* 4        tab spacing */
  238.     unsigned short pagelength;    /* 57        maximum lines/page (no cc) */
  239.     unsigned short pagelencc;    /* 59        maximum lines/page (with cc) */
  240.     unsigned short top;            /* 14        top margin, inches*72 */
  241.     unsigned short headmarg;    /* 2        lines between header & text (no cc) */
  242.     unsigned short left;        /* 12        left margin, inches*72 (no cc) */
  243.     unsigned short leftcc;        /* 0        left margin, inches*72 (with cc) */
  244.     unsigned short titlewidth;    /* 74        width of title line in characters */
  245.                                 /*            *cannot exceed 132* */
  246.     unsigned short unused1;        /* 0        space for future additions */
  247.     unsigned short unused2;        /* 0                                   */
  248.     unsigned short unused3;        /* 0                                   */
  249.     unsigned short unused4;        /* 0                                   */
  250.     } vmprt;            /* this structure is stored in the VMPR 128 resource */
  251.  
  252. #define MAXLINEWIDTH 132        /* maximum allowed for line width */
  253.  
  254. /* point positions for selected text
  255.  
  256.          3---------------------4
  257.          |                     |
  258.   1------2                     |
  259.   |                            |
  260.   |                            |
  261.   |              6-------------5
  262.   |              |
  263.   8--------------7
  264.                                     */
  265.  
  266. typedef struct {        /* coordinates defining selected text */
  267.     short x1;
  268.     short y1;
  269.     short x2;
  270.     short y2;
  271.     short x3;
  272.     short y3;
  273.     short x4;
  274.     short y4;
  275.     short x5;
  276.     short y5;
  277.     short x6;
  278.     short y6;
  279.     short x7;
  280.     short y7;
  281.     short x8;
  282.     short y8;
  283.     } selcoord;
  284.     
  285. typedef struct {                /* data for each connection */
  286.     unsigned char readbuff[4624];    /* data transmitted to host */
  287.                                     /* size based on vmxfer maximum response: 
  288.                                         6 byte prefix
  289.                                         2 bytes: DB
  290.                                         4608 bytes: 2304 bytes of data with IAC quoting
  291.                                         5 bytes: CRC suffix
  292.                                         2 bytes: IAC, EOR
  293.                                         1 byte padding
  294.                                         ==> 4624 bytes        */
  295.     short rbsize;                    /* current number of bytes in readbuff */
  296.     short rballoc;                    /* allocated size of readbuff */
  297.     WindowRecord wRecord;
  298.     GrafPort *myWindow;
  299.     GrafPort WritePort;
  300.     GrafPtr WritePtr;
  301.     unsigned char * mapptr;
  302.     GrafPort PictPort;
  303.     GrafPtr PictPtr;
  304.     unsigned char * pmapptr;
  305.     unsigned char wsfbuff[8192];    /* buffer for accumulating wsf data */
  306.     unsigned char *nlbuff;            /* buffer for language translation */
  307.                                     /* size = screen width */
  308.     DialogRecord dlgrec;            /* for file transfer dialog */
  309.     Cursor **grafcursor;
  310.     short ldvoff;
  311.     unsigned char * chrbuff;
  312.     unsigned short * atrbuff;
  313.     short curadr;
  314.     short bufadr;
  315.     short chratr;
  316.     short WriteCurr;
  317.     Rect er;
  318.     short x;
  319.     short y;
  320.     Rect inrect;
  321.     short in_len;
  322.     short in_off, in_atr;
  323.     short hpixsize;
  324.     short vpixsize;
  325.     short scrvoff;
  326.     short scrhsize;
  327.     short scrhoff;
  328.     short htxtstrt;
  329.     short vtxtstrt;
  330.     short vtxtsize;
  331.     short htxtsize;
  332.     short curvsize;
  333.     short curhsize;
  334.     short curnum;
  335.     short x_origin;
  336.     short y_origin;
  337.     short maxcnt;
  338.     short maxoff;
  339.     long textsize;                    /* size in bytes for stginfo */
  340.     long pictsize;
  341.     kbdata kbqueue[KBQMAX];            /* keyboard input queue */
  342.     short kbqsize;
  343.     short savedoffset;                /* saved info. for getattr */
  344.     short savedattr;
  345.     writeinfo writesave[WRITEINFOCOUNT];  /* write debugging data */
  346.     struct machinfo * mp;            /* info for machine we connect to (NCSA) */
  347.     int myport;                        /* tcp port to close from netopen */
  348.     short sessrefnum;                /* session SPPC refnum */
  349.     unsigned char sppcname[16];        /* SPPC session name (for info only) */
  350.     short sesspref;                    /* port refnum for session */
  351.     unsigned char ppcname[32];        /* PPC session name (for info only) */
  352.     short apiopenrefnum;            /* SPPC client refnum for open */
  353.     unsigned long apiopensref;        /* PPC session refnum for open */
  354.     unsigned long apiopenmsgid;        /* SPPC/PPC message id of open request */
  355.     short apicloserefnum;            /* SPPC client refnum for notify */
  356.     unsigned long apiclosesref;        /* PPC session refnum for close */
  357.     unsigned long apiclosemsgid;    /* SPPC/PPC message id of notify request */
  358.     short apiwriterefnum;            /* SPPC client refnum for notify */
  359.     unsigned long apiwritesref;        /* PPC session refnum for write */
  360.     unsigned long apiwritemsgid;    /* SPPC/PPC message id of notify request */
  361.                                     /* current settings */
  362.     unsigned char cshostname[256];
  363.     unsigned char cswtitle[256];    /* title for our window */
  364.     unsigned char cskybdname[256];
  365.     unsigned char csnlname[256];    /* initialized at startup from first menu item */
  366.     unsigned char cssndname[256];    /* initialized at startup from dfltsoundname */
  367.     settings_list cs;
  368.                                     /* settings to/from file */
  369.     unsigned char fshostname[256];
  370.     unsigned char fswtitle[256];
  371.     unsigned char fskybdname[256];
  372.     unsigned char fsnlname[256];
  373.     unsigned char fssndname[256];
  374.     settings_list fs;
  375.     unsigned char s_fName[64];        /* last filename used */
  376.     unsigned char connhostname[256];    /* host name for actual connection */
  377.                                     /* cshostname or prompt response */
  378.     unsigned char hostonly[256];    /* just hostname from connhostname */
  379.     unsigned char sessname[250];    /* name which describes this session */
  380.     short sessnameseq;                /* sequence number for name */
  381.     short ioerror;                    /* terminal I/O error code */
  382.     short cur_rows;                    /* row count for current display */
  383.     short cur_cols;                    /* column count for current display */
  384.     short cur_ptsize;                /* point size for current display */
  385.     unsigned char **kb_handle;        /* handle to current keyboard mapping */
  386.     unsigned char **nl_handle;        /* handle to current language mapping */
  387.     unsigned char nltab[256];        /* national language translation table */
  388.     unsigned char xtradata[64];        /* variables for data stream processing */
  389.     short wsfleft;
  390.     short xtralen;
  391.     short xtrainit;
  392.     short stdfont;                    /* no. of standard font (add 2 for bold) */
  393.     Handle sndhandle;                /* handle to 'snd ' resource for beep */
  394.     RgnHandle cliprgn;                /* regions for grow icon handling */
  395.     RgnHandle destrgn;
  396.     Rect pRect;
  397.     Rect sizeRect;
  398.     Rect statRect;
  399.     Rect textRect;
  400.     Rect scrnRect;
  401.     Rect pictRect;
  402.     Rect cposRect;                    /* rectangle for cursor postion numbers */
  403.     Rect gr_rect;                    /* grow icon rectangle */
  404.     DialogPtr xdlgptr;
  405.     char hisopts[256];
  406.     char myopts[256];
  407.     unsigned char subbuffer[100];
  408.     unsigned char *subpointer;
  409.     unsigned char *subend;
  410.     unsigned char replybuff[100];
  411.     unsigned char *replyptr;
  412.     PaletteHandle myPalette;
  413.     short pxsize;
  414.     short telrcv_state;                /* FSA state */
  415.     short askedSGA;                    /* we have talked about SGA */
  416.     unsigned long last_t;
  417.     unsigned char statresult[24];
  418.     RGBColor rgbbk;                    /* save for restore call */
  419.     short init_loc;
  420.     short sel_loc;
  421.     short msgoffset;
  422.     unsigned char *linetext;
  423.     unsigned short *lineattr;
  424.     short linelen;
  425.     unsigned char *proctext;
  426.     unsigned short *procattr;
  427.     unsigned char *prochost;
  428.     selcoord lastsel;
  429.     short attrloc;                    /* location where last attribute was stored */
  430.     unsigned char *pastebuff;
  431.     short pastebuffsize;
  432.                             /* vmxfer variables */
  433.     DateTimeRec wdate;
  434.     unsigned char statbuf[80];
  435.     unsigned char * rbuf;            /* received data */
  436.     unsigned char * sbuf;            /* data sent as reply */
  437.     short rlen;                        /* size of rbuf */
  438.     short slen;                        /* size of sbuf */
  439.     short xfspeed;                    /* file transfer character rate */
  440.     short rfd, wfd;                    /* read & write file descriptors */
  441.     short wfd_r;                    /* MacBinary resource fork descriptor */
  442.     short vnum;                        /* volume descriptor for RMAC/WMAC */
  443.     unsigned char macFName[258];     /* complete Mac file name */
  444.     unsigned char macVName[29];         /* Mac volume name */
  445.                                     /* both have length byte followed by
  446.                                        C string */
  447.     unsigned int cursiz;            /* number of sectors transferred */
  448.     unsigned int filsiz;            /* total number of sectors */
  449.     unsigned char statname[14];        /* "uploading" or "downloading" */
  450.     unsigned char prtbuf2[120];        /* message buffers */
  451.     unsigned char prtbuf3[120];
  452.     unsigned char prtbuf4[120];
  453.     struct mbhdr mh;                /* MacBinary header */
  454.     long mbdbmax;                    /* MacBin data size in blocks */
  455.     long mbrbmax;                    /* MacBin resource size in blocks */
  456.     long mbdsize;                    /* MacBin data fork length */
  457.     long mbrsize;                    /* MacBin resource fork size */
  458.     long mbdextra;                    /* MacBin data fork padding */
  459.     long mbrextra;                    /* MacBin resource fork padding */
  460.     TPPrPort prtport;
  461.     short myFirst;
  462.     short myLast;
  463.     unsigned char rtnvol[28];
  464.     short prtlen;
  465.     short prtlen1;
  466.     short prtlen2;
  467.     int lineoffset;
  468.     int tt1len;
  469.     int pgnum;
  470.     unsigned char tt1[MAXLINEWIDTH+1];
  471.     unsigned char tt2[MAXLINEWIDTH+1];
  472.     unsigned char newline1[MAXLINEWIDTH+2];    /* extra space for cc and null */
  473.     unsigned char newline2[MAXLINEWIDTH+2];    
  474.                             /* end of vmxfer variables */
  475.                             /* start of graphics variables */
  476.     short pleft;                    /* byte counts for segment processing */ 
  477.     short cleft;
  478.     Pattern dfltpat;                /* default area pattern */
  479.     short copymode ;                /* current mode for CopyBits */
  480.     unsigned char pictbuff[257];
  481.     unsigned char ctlbuff[257];
  482.     unsigned char pict_fName[64];    /* name of open PICT file (pascal) */
  483.     short pictvref;                    /* volume reference for open PICT file */
  484.     short pictfref;                    /* file reference for open PICT file */
  485.     PicHandle picthandle;            /* handle for saved picture */
  486.     long pictcount;                    /* size of picture */
  487.     OSErr picterr;                    /* error (if any) during writing */
  488.     CQDProcs myProcs;                /* proc pointers for changing */
  489.     Handle theWidth;                /* Handle for SetLineWidth */
  490.     short xmin;                        /* variables to define rectangle */
  491.     short xmax;
  492.     short ymin;
  493.     short ymax;
  494.     short ptemp1;
  495.     short pboff;
  496.     short pcount;
  497.     short xpos;
  498.     short ypos;
  499.     Pattern fillpat;                /* current area pattern */
  500.     PolyHandle mypoly;
  501.     unsigned char markstr[2];        /* one-byte Pascal string */
  502.     BitMap image_srcBits;
  503.     Rect image_srcRect;
  504.     Rect image_dstRect;
  505.     short image_rowcount;
  506.     short ctemp1;
  507.     short cboff;
  508.     short ccount;
  509.                             /* end of graphics variables */
  510.     char quitflg;
  511.     char data_init;                    /* flag for start of new write */
  512.     char sent3270tt;                /* flag for sent 3270 type */
  513.     char hadascii;                    /* flag for have had ascii data */
  514.      char newserver;                    /* Telnet server supports new protocol */
  515.     char skiplf;
  516.     char escmode;
  517.     char fsinv;                        /* 3270 pending invldscr */
  518.     char drawpict;
  519.     char newpict;
  520.     char kblock;
  521.     char kblcode;
  522.     char aplmode;
  523.     char insmode;
  524.     char online;
  525.     char ptfill;
  526.     unsigned char lastwcc;
  527.     char fmtscrn;
  528.     unsigned char rdaid;
  529.     char cur_mode;                    /* current display mode: 0 = normal, 1 = alt. */
  530.     char addr14;                    /* generate 14-bit addresses for this session */
  531.     char serflg;                    /* true = async */
  532.     char tcpflg;                    /* true = TCP/IP */
  533.     char apiopen;                    /* true if current session opened by API */
  534.     char apiopenpend;                /* api open response not sent yet */
  535.     char apiopenkind;                /* 0 = PPC, 1 = SPPC */
  536.     char apiclosenotify;            /* true if close notification wanted */
  537.     char apiclosekind;                /* 0 = PPC, 1 = SPPC */
  538.     char apiwritenotify;            /* true if write notification wanted */
  539.     char apiwritekind;                /* 0 = PPC, 1 = SPPC */
  540.     unsigned char apikberr;            /* error code for API input processing */
  541.     char apinoalert;                /* api wants alerts suppressed */
  542.     char apihide;                    /* api wants window hidden */
  543.     char logon;                        /* user logged-in to server */
  544.     char ewamode;                    /* logical erase/write state: 0 = default, 1 = alt. */
  545.     char pndbeep;                    /* pending bell */
  546.     char pndclr;                    /* pending clrpict */
  547.     char needwrite;                    /* call to writescr needed */
  548.     char kb_err;                    /* kb entry error code */
  549.     char wr_active;                    /* statline write active flag */
  550.     char zoomok;                    /* true if window can be zoomed */
  551.     char fixbracket;                /* don't use GE with [, ] */
  552.     char savepict;                    /* save graphics in PICT file */
  553.     char textsel;                    /* text selected for cut/copy/clear */
  554.     char textmap;                    /* flag for presence of text bitmap */
  555.     char plainala;                    /* if true, suppress ALA overstrikes */
  556.     char wposok;                    /* true if saved window position is valid */
  557.     char sess_sppc;                    /* true if session registered ok */
  558.     char sessppc;                    /* true if session opened a port */
  559.     char connstate;                    /* connection state */
  560.     char skipnewmode;                /* skip call to newmode for EW/EWA */
  561.     char statcpos;                    /* only draw curor position in status line */
  562.     char pendalign;                    /* alignbitmap call pending */
  563.     char serverconn;                /* connecting to non-terminal server*/
  564.     char servermode;                /* server connection active */
  565.     char serverflags;                /* flags bits for special server processing */
  566.     char showfkey;                    /* controls enabling of fkey menu */
  567.     char wsfflag;                    /* variables for data stream state */
  568.     unsigned char * wsfptr;
  569.     unsigned char wsfop;
  570.     unsigned char lstopcd;
  571.     char needtoend;
  572.     char msg1flg;
  573.     char inschar;
  574.     char hostok;
  575.     char framedfield;            /* screen contains framed fields */
  576.     unsigned char last_stat_time;
  577.     char showsel;
  578.     char colorfield;
  579.     char cutflag;
  580.     char respflag;
  581.     char savedvalid;            /* for getattr's saved info. */
  582.     char pastebeep;                /* beep needed after paste finishes */
  583.     char pasteactive;            /* using paste queue instead of keyboard queue */
  584.     char fsoldformat;            /* "fs" settings are for old file format */
  585.                         /* vmxfer char variables */
  586.     char ropen;                    /* flags indicating file open for rd/wr */
  587.     char wopen;
  588.     char vmxbgn;                /* xfer mode active flag */
  589.     char vmxsub;                /* xfer subset mode active flag */
  590.     char kabort;                /* "keyboard" abort flag */
  591.     char xdlg;                    /* xfer dialog opened */
  592.     char binxf;                    /* binary mode file transfer */
  593.     char mbinxf;                /* MacBinary file transfer */
  594.     char prtxf;                    /* downloading print file */
  595.     char prtcc;                    /* print file has carriage control */
  596.     char prpgopen;                /* print page open */
  597.     char prfileinit;            /* print file initializtion done */
  598.     char prdocopen;                /* print document open */
  599.     char cmpstate;                /* state for compression */
  600.     unsigned char prevchar;        /* previous character for compression */
  601.     char crcok;                    /* true if crc has been appended */
  602.     char xlflag;                /* true if XL command has been recieved */
  603.     char nomenu;                /* "nomenu" option specified */
  604.     char nextcc;
  605.                         /* end of vmxfer char variables */
  606.                         /* start of graphics char variables */
  607.     struct {
  608.         unsigned char wsf_op;
  609.         unsigned char wsf_gr;
  610.         unsigned char grf_op;
  611.         } wsfdbg;
  612.     unsigned char dfltcolor;        /* default color =  green */
  613.     unsigned char dfltlw;            /* default line width = 1 pixel */
  614.     unsigned char dfltlt;            /* default line type = solid */
  615.     unsigned char dfltmarker;        /* default marker = diamond */
  616.     unsigned char dfltmix;            /* default mix mode */
  617.     unsigned char linew;            /* current line width */
  618.     unsigned char linet;            /* current line type */
  619.     char pictopen;                    /* true when PICT file is open */
  620.     char area_active;                /* flag to indicate area is active */
  621.     char image_active;                /* flag to indicate image data is active */
  622.     char pmode;
  623.     unsigned char markchar;            /* current marker */
  624.     unsigned char aflags;
  625.     char cmode;
  626.     char openflg;
  627.                         /* end of graphics char variables */
  628.     } cnr;
  629.  
  630. typedef struct WorldTable {
  631.     unsigned char *    WTPCBPtr;
  632.     short            WTFlags;
  633.     ProcPtr            WTBgtask;
  634.     Handle            WTScrbits;
  635.     WindowPtr        WTDeskAcc;
  636.     } WorldTable;
  637.  
  638. #define DFLTWHITE    {0xffff, 0xffff, 0xffff}
  639. #define DFLTYELLOW    {0xfc00, 0xf37d, 0x052f}
  640. #define DFLTRED        {0xdd6b, 0x08c2, 0x06a2} /* in 16-color ctab */
  641. #define CTDFLTPINK    {0xf2d7, 0x0856, 0x84ec} /* in 16-color ctab */
  642. #define DFLTPINK    {0xffff, 0x7a5d, 0x9f8e}
  643. #define CTDFLTBLUE    {0x0000, 0x0000, 0xd400} /* in 16-color ctab */
  644. #define DFLTBLUE    {0x4eba, 0x6aea, 0xdd6b}
  645. #define CTDFLTTURQUOISE  {0x0241, 0xab54, 0xeaff} /* in 16-color ctab */
  646. #define DFLTTURQUOISE  {0x0000, 0xc42f, 0xeaff}
  647. #define DFLTGREEN    {0x25ea, 0xdf93, 0x1897}
  648. #define    DFLTBLACK    {0x0000, 0x0000, 0x0000}
  649. #define DFLTBACK    {0xf00, 0xf00, 0xf00}
  650. #define CTDFLTBACK    {0x4000, 0x4000, 0x4000}    /* in 16-color ctab */
  651. #define DFLTSTAT    {0x8600, 0x8600, 0x8600}
  652.  
  653.                         /* palette indices for colors */
  654. #define RGBblack        1
  655. #define RGBwhite        2
  656. #define RGBback            3
  657. #define RGBgreen        4
  658. #define RGBred            5
  659. #define    RGBblue            6
  660. #define RGBpink            7
  661. #define RGByellow        8
  662. #define RGBturquoise    9
  663. #define RGBstat            10
  664.  
  665. typedef struct scrapline {        /* definition of private scrap line element */
  666.     struct scrapline *nextline;
  667.     unsigned char *text;
  668.     unsigned short *attr;
  669.     } scrapline;
  670.     
  671. typedef struct hexmap {
  672.     unsigned short offset;
  673.     unsigned char stdchar;
  674.     unsigned char aplchar;
  675.     } hexmap;
  676.     
  677. typedef struct uareply {        /* Usable Area Query Reply */
  678.     unsigned short length;            /* structured field total length  (46) */
  679.     unsigned char sfid;                /* structured field id (X'81') */
  680.     unsigned char qcode;            /* usable area id (X'81') */
  681.     unsigned char flags1;            /* first flag byte  (X'03') */
  682.     unsigned char flags2;            /* second flag byte  (X'00') */
  683.     unsigned short w;                /* width of usable area  (computed) */
  684.     unsigned short h;                /* height of usable area (computed) */
  685.     unsigned char units;            /* units of measure (X'00' = inches) */
  686.     unsigned char xr[4];            /* x point spacing (X'00010048' = 1/72) */
  687.     unsigned char yr[4];            /* y point spacing (X'00010048' = 1/72) */
  688.     unsigned char aw;                /* width of default cell  (computed) */
  689.     unsigned char ah;                /* height of default cell (computed) */
  690.     unsigned char buffsz[2];        /* character buffer size (X'0000') */
  691.     unsigned char xmin;                /* minimum x units in cell (X'00') */
  692.     unsigned char ymin;                /* minimum y units in cell (X'00') */
  693.     unsigned char xmax;                /* maximum x units in cell (X'00') */
  694.     unsigned char ymax;                /* maximum y units in cell (X'00') */
  695.     unsigned char aualen;            /* length for alternate usable area (X'13') */
  696.     unsigned char auapid;            /* parameter id for alt. usable area (X'02') */
  697.     unsigned char auares;            /* reserved (X'00') */
  698.     unsigned char auaid;            /* id for alt. usable area partition (X'01') */
  699.     unsigned char waua[2];            /* width of alt. usable area (computed) */
  700.     unsigned char haua[2];            /* height of alt. usable area (computed) */
  701.     unsigned char auaunits;            /* units of measure (X'00' = inches) */
  702.     unsigned char auaxr[4];            /* x point spacing (X'00010048' = 1/72) */
  703.     unsigned char auayr[4];            /* y point spacing (X'00010048' = 1/72) */
  704.     unsigned char awaua;            /* width of default cell  (computed) */
  705.     unsigned char ahaua;            /* height of default cell (computed) */
  706.     } uareply;
  707.     
  708. typedef struct ipreply {        /* Implicit Partition Query Reply */
  709.     unsigned short length;            /* structured field total length  (28) */
  710.     unsigned char sfid;                /* structured field id (X'81') */
  711.     unsigned char qcode;            /* implicit partition id (X'A6') */
  712.     unsigned char flags[2];            /* flags - reserved (X'0000') */
  713.     unsigned char scrnlen;            /* length of screen parameters (X'0B') */
  714.     unsigned char scrnpid;            /* screen parameter id (X'01') */
  715.     unsigned char scrnflags;        /* screen flags - reserved (X'00') */
  716.     unsigned char wd[2];            /* default width in chars (computed) */
  717.     unsigned char hd[2];            /* default height in chars (computed) */
  718.     unsigned char wa[2];            /* alternate width in chars (computed) */
  719.     unsigned char ha[2];            /* alternate height in chars (computed) */
  720.     unsigned char celllen;            /* length of cell sizes (X'0B') */
  721.     unsigned char cellpid;            /* cell size parameter id (X'02') */
  722.     unsigned char cellflags;        /* cell size flags - reserved (X'00') */
  723.     unsigned char wcd[2];            /* default cell width (computed) */
  724.     unsigned char hcd[2];            /* default cell height (computed) */
  725.     unsigned char wca[2];            /* alternate cell width (computed) */
  726.     unsigned char hca[2];            /* alternate cell height (computed) */
  727.     } ipreply;
  728.     
  729. #define NMRNUM    2                    /* number of notification manager messages */
  730.  
  731. typedef struct {                    /* Notification Manager record and message */
  732.     NMRec qelem;
  733.     unsigned char msg[256];
  734.     } nmrmessage;
  735.  
  736. typedef struct {
  737.     unsigned char *next;            /* actually qctl* */
  738.     char inuse;
  739.     char pend_inuse;
  740.     } qctl;
  741.  
  742. typedef struct {                    /* PPC queue descriptor */
  743.     unsigned char name[8];    /* name of queue (for messages) */
  744.     qctl *first;            /* pointer to first element */
  745.     Size elemsize;            /* size of one queue element */
  746.     short minavail;            /* allocate to keep this many available */
  747.     char stgerr;            /* allocation failed */
  748.     char spare;
  749.     } queueinfo;
  750.  
  751. typedef struct {
  752.     long sessrefnum;
  753.     long userdata;
  754.     cnr *cp;                /* 0 for session manager */
  755.     char servicetype;
  756.     char reqtype;
  757.     } clientinfo;
  758.     
  759. typedef struct {
  760.     long length;
  761.     long userdata;
  762.     long creator;
  763.     long type;
  764.     long sessrefnum;
  765.     char more;
  766.     char incoming;            /* true if data from PPCRead */
  767.     unsigned char msg[128];
  768.     } datainfo;
  769.     
  770. typedef struct {
  771.     qctl header;
  772.     PPCParamBlockRec pb;
  773.     } paramrec;
  774.  
  775. typedef struct {
  776.     qctl header;
  777.     clientinfo client;
  778.     } clientrec;
  779.  
  780. typedef struct {    
  781.     qctl header;
  782.     datainfo data;
  783.     } datarec;
  784.